const computedBehavior = require('miniprogram-computed');
Component({
  behaviors: [computedBehavior],

  properties: {
    isShow: {
      type: Object,
      value: false
    },
    
    images: {
      type: Object,
      value: {
        label: '',
        list: []
      }
    }
  },

  data: {
    indicator: 1
  },

  computed: {
    counter(data) {
      const { indicator, images: { list = [] } } = data;
      return `${indicator}/${list.length}`
    }
  },

  methods: {
    changeIndicator(e) {
      const { current } = e.detail;
      this.setData({
        indicator: current + 1
      });
    },

    onClose() {
      this.setData({
        indicator: 1
      });
      this.triggerEvent('click');
    }
  }
})
